package com.shop.cn.goods.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author:asheng
 * @Date: 2021/7/1 10:39 下午
 */
@RestController
@RequestMapping("/sku")
public class SkuController {

    @Autowired
    LoadBalancerClient loadBalancerClient;

    @Value("${config.info}")
    String info;

    @Value("${common.name}")
    String name;
    @Autowired
    ConfigurableApplicationContext applicationContext;

    @GetMapping("/test")
    public String serviceTest(){
        System.out.println("====进入商品=====");
        System.out.println(info);
        System.out.println(name);
        String info1 = applicationContext.getEnvironment().getProperty("config.info");
        String name1 = applicationContext.getEnvironment().getProperty("common.name");
        System.out.println(name1);
        System.out.println(info1);


        return "获取商品";
    }


}
